<?php
/* 
 * Copyright (c) 2018-2021   All rights reserved.
 * 
 * 创建时间：2021-04-26 17:14
 *
 * 项目：upload  -  $  - threadListWidget.php
 *
 * 作者：liwei 
 */

namespace modules\levfm\widgets\threadList;

!defined('INLEV') && exit('Access Denied LEV');

use Lev;
use lev\base\Widgetv;
use lev\dz\dzDBHelper;
use modules\levfm\table\dzSettingHelper;

class threadListWidget extends Widgetv
{

    public static function run($fidArr = false, $limit = 10, $show = false)
    {
        if (empty(Lev::$app['isDiscuz'])) return '';

        $fidArr === false && $fidArr = static::getFids();
        $threadLists = dzDBHelper::threadLists($fidArr, $limit);

        if (!$threadLists) return '';

        return parent::render($show, __DIR__ . '/views/run.php', [
            'threadLists' => $threadLists,
        ]);

    }

    public static function getFids() {
        return dzSettingHelper::fidArr();

    }
}